const Response = require("../../class/Response");

WSC.onMessagePurpose(CONSTANTS.MESSAGE_PURPOSE.COMMAND_REQUEST, (wsclient, req, res)=>{
    res = Response.replyTo(req, Response.MODE.CMD_RESPONSE);
    
    // 服务：初始化vanilla客户端名称
    if (req.body?.metaData?.purpose == '/vanilla/init/name'){
        res.body.victim = [CONF.CONFIG.get('Websocket')['ServerName']];
        res.data.userType = 'bds';
        res.setStatusCode(0);
        res.setStatusMessage('');
        wsclient.sendJson(res.json);
        return false;
    }
    // 服务：初始化vanilla客户端坐标
    if (req.body?.metaData?.purpose == '/vanilla/init/pos'){
        res.body.position = { x: 0, y: -64, z: 0 };
        res.setStatusCode(0);
        res.setStatusMessage('');
        wsclient.sendJson(res.json);
        return false;
    }
});